package org.weasel.unittests;

import junit.framework.TestCase;

import org.weasel.business.Developer;
import org.weasel.business.Project;
import org.weasel.business.Release;
import org.weasel.business.Unscheduled;

public class ProjectTest extends TestCase {

	private Project project;
	
	protected void setUp() throws Exception {
		super.setUp();
		project = new Project("pId", "pName", null, null, new Unscheduled("uID", null), "", "15.05.2007", 6);
	}

	protected void tearDown() throws Exception {
		super.tearDown();
		project = null;
	}

	public void testAddRelease() {
		Release r = new Release("rID", "rName", null, new Unscheduled("uID", null), "");
		project.addRelease(r);
		Release rCheck = project.getRelease(r.getId());
		assertEquals(r.getId(), rCheck.getId());
	}

	public void testRemoveRelease() {
		Release r = new Release("rID", "rName", null, new Unscheduled("uID", null), "");
		project.addRelease(r);
		project.removeRelease(r.getId());
		assertNull(project.getRelease(r.getId()));
	}

	public void testAddGetDeveloper() {
		Developer d = new Developer("HInnerhofer", "Hannes", "Stift", "keine@gmx.net");
		project.addDeveloper(d);
		Developer dCheck = project.getDeveloper(d.getId());
		assertEquals(d.getId(), dCheck.getId());
	}

	public void testRemoveDeveloper() {
		Developer d = new Developer("HInnerhofer", "Hannes", "Stift", "keine@gmx.net");
		project.addDeveloper(d);
		project.removeDeveloper(d.getId());
		assertNull(project.getDeveloper(d.getId()));
	}

}
